﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using EntityDA;
using BussinessObject;

public partial class NhapSachMoi : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnThem_Click(object sender, EventArgs e)
    {
        try
        {
            SachData data = new SachData();
            SachDB db = new SachDB();
            data.TenSach = txtTenSach.Text;
            data.ThongTin = txtThongTinSach.Text;
            data.GiaNhap = Decimal.Parse(txtGiaNhap.Text);
            data.GiaBia = Decimal.Parse(txtGiaBia.Text);
            data.GiaBan = Decimal.Parse(txtGiaBan.Text);
            data.SoLuong = Int32.Parse(txtSoLuong.Text);
            data.MaLoai = Int32.Parse(dropLoaiSach.Text);
            data.Hinh = uploadHinhSach.FileName;
            string path = Server.MapPath("~/HinhSach/");
            uploadHinhSach.SaveAs(path + data.Hinh);
            db.ThemSach(data);
        }
        catch
        {

        }

    }
    protected void btnNhapLai_Click(object sender, EventArgs e)
    {

    }
}
